package com.iwhalecloud.citybrain.flow.platform.manager.application.common.enums;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public enum WeekEnum {

    SUNDAY("1", "周日"),

    MONDAY("2", "周一"),

    TUESDAY("3", "周二"),

    WEDNESDAY("4", "周三"),

    THURSDAY("5", "周四"),

    FRIDAY("6", "周五"),

    SATURDAY("7", "周六");

    private String code;

    private String description;

    private static Map<String, String> codeToDesc = new HashMap<>();

    static {
        Arrays.asList(values()).forEach(item -> codeToDesc.put(item.getCode(), item.getDescription()));
    }

    WeekEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static String getDescrByCode(String code) {
        return codeToDesc.get(code);
    }

    public static Map<String, String> getCodeToDesc() {
        return codeToDesc;
    }

    public static void setCodeToDesc(Map<String, String> codeToDesc) {
        WeekEnum.codeToDesc = codeToDesc;
    }
}
